export default {
    //数值格式化
    numFormat(num, n = 4) {
        return Math.round(num * Math.pow(10, n)) / Math.pow(10, n);
    },
    //计算对象数组中某个属性合计
    countPrice(arr, keyName) {
        let price = 0;
        price = arr.reduce(function (total, currentValue, currentIndex, arr) {
            return currentValue[keyName] ? (total + currentValue[keyName]) : total;
        }, 0);
        return price;
    },

}